package cn.dkk.structure_design.flyweight.pojo;

import java.util.HashMap;

/**
 * @author dkk
 * @date 2022/7/19
 * @desc
 */
public class BoxFactory {

    private static HashMap<String,AbstractBox> boxMap;

    private static BoxFactory boxFactory = new BoxFactory();

    private BoxFactory(){
        boxMap=new HashMap<>();
        boxMap.put("I",new IBox());
        boxMap.put("L",new LBox());
        boxMap.put("O",new OBox());
    }

    public static BoxFactory getBoxFactory(){
        return boxFactory;
    }

    public AbstractBox getBox(String name){
        return boxMap.get(name);
    }

}
